package com.szx.kaihei.config;


import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
public class AliyunSmsConfig {
    @Value("${aliyun.sms.accessKeyId}")
    private String  accessKeyId;
    @Value("${aliyun.sms.accessKeySecret}")
    private String  accessKeySecret;
    @Value("${aliyun.sms.endpoint}")
    private String  endpoint;
    @Value("${aliyun.sms.signName}")
    private String  signName;
    @Value("${aliyun.sms.templateCode}")
    private String  templateCode;

    public Client createClient() throws Exception {
        Config config = new Config();
        config.accessKeyId = accessKeyId;
        config.accessKeySecret = accessKeySecret;
        config.endpoint = endpoint;

        return new Client(config);
    }
}
